package com.cy.service.impl;

import com.cy.dao.NoticeDao;
import com.cy.pojo.Notice;
import com.cy.service.NoticeService;
import com.cy.web.common.annotation.RequiredLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {

    private static final Logger log=
            //通过工厂创建日志对象
            LoggerFactory.getLogger(NoticeServiceImpl.class);

    @Autowired
    private NoticeDao noticeDao;

    @RequiredLog(operation="公告查询")
    @Override
    public List<Notice> getNotices(Notice notice) {
        return noticeDao.selectNotices(notice);
    }

    @Override
    public int saveNotice(Notice notice) {
        return noticeDao.insertNotice(notice);
    }

    @Override
    public int deleteNotices(Long... ids) {
        return noticeDao.deleteNotices(ids);
    }

    @Override
    public int deleteNotice(Long id) {
        return noticeDao.deleteNotice(id);
    }

    @Override
    public int updateNotice(Notice notice) {
        return noticeDao.updateNotice(notice);
    }

    @Override
    public Notice getNoticeById(Long id) {
        return noticeDao.selectById(id);
    }
}
